package com.frogs.ucenter.v1.service.insurance.center;

import java.util.Map;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.frogs.ucenter.entity.InsuranceInfo;
import com.frogs.ucenter.entity.InsuranceRecord;
import com.frogs.ucenter.entity.PartnerInsuranceRecord;
import com.frogs.ucenter.v1.request.InsuranceRecordAddRequest;
import com.frogs.ucenter.v1.service.PartnerInsuranceCompanyService;
import com.frogs.ucenter.v1.util.ApiConstants;

@Service(ApiConstants.VERSION+"partnerInsuranceCompanyCenter")
public class PartnerInsuranceCompanyCenter {

	private Map<Integer, PartnerInsuranceCompanyService> partnerInsuranceCompanyServiceMap;

	public Map<Integer, PartnerInsuranceCompanyService> getPartnerInsuranceCompanyServiceMap() {
		return partnerInsuranceCompanyServiceMap;
	}

	public void setPartnerInsuranceCompanyServiceMap(
			Map<Integer, PartnerInsuranceCompanyService> partnerInsuranceCompanyServiceMap) {
		this.partnerInsuranceCompanyServiceMap = partnerInsuranceCompanyServiceMap;
	}

	/**
	 * 创建表单
	 * 
	 * @param request
	 * @param insuranceInfo
	 * 
	 * @return
	 * @throws Exception 
	 */
	public PartnerInsuranceRecord add(InsuranceRecordAddRequest request , InsuranceInfo insuranceInfo,InsuranceRecord record) throws Exception {
		PartnerInsuranceCompanyService service = partnerInsuranceCompanyServiceMap.get(insuranceInfo.getCompanyId());
        return service.add(request,insuranceInfo,record);
	}
	
	/**
	 * 退保单
	 * 
	 * @param insuranceInfo
	 * @param record
	 * 
	 * @return
	 * @throws Exception 
	 */
	public JSONObject quit(InsuranceInfo insuranceInfo , InsuranceRecord record) throws Exception {		
		PartnerInsuranceCompanyService service = partnerInsuranceCompanyServiceMap.get(insuranceInfo.getCompanyId());
        return service.quit(insuranceInfo,record);
	}
}
